<html>
<head><meta charset="utf-8"><title>datalog-to-datafrog · t-compiler/wg-polonius · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/index.html">t-compiler/wg-polonius</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog.html">datalog-to-datafrog</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="177305332"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog/near/177305332" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog.html#177305332">(Oct 04 2019 at 02:18)</a>:</h4>
<p>Ok here's the datalog-to-datafrog "prototyping compiler" PR I mentioned before: <a href="https://github.com/rust-lang/polonius/pull/132" target="_blank" title="https://github.com/rust-lang/polonius/pull/132">https://github.com/rust-lang/polonius/pull/132</a> it does help when trying out rules (or doing Demand Transformation)</p>
<p>I've been bitten by weirdness around <code>write!</code>, <code>rustfmt</code> and whitespace line-endings inside the macro, so I'm not sure it'll pass CI. (It does pass locally, but was having random whitespace added/removed). It's not supposed to be especially robust or anything, just giving it valid decls and rules, and it should work: normally one mostly just has to add where to find the data to put in the Relations/Variables. I tested this workflow on the <code>Naive</code> rules and it passed tests after I filled the 5-6 relations in <code>AllFacts</code>. </p>
<p>(this thing is also inefficient &amp; clones strings left and right but oh well :)</p>
<p>let me know what you think</p>



<a name="177373591"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog/near/177373591" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog.html#177373591">(Oct 04 2019 at 19:53)</a>:</h4>
<p>I think it’s pretty gosh damned cool is what I think</p>



<a name="177374703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog/near/177374703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog.html#177374703">(Oct 04 2019 at 20:07)</a>:</h4>
<p>(it's still very buggy but I'll fix it over time, add tests etc)</p>



<a name="177470152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog/near/177470152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog.html#177470152">(Oct 06 2019 at 17:58)</a>:</h4>
<p>(yeah, maybe that should be in its own repo temporarily, until it's more stable and better tested, before being upstreamed in datafrog, so I'll close the PR for now and move it to a more appropriate location)</p>



<a name="177501024"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog/near/177501024" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog.html#177501024">(Oct 07 2019 at 08:51)</a>:</h4>
<p>There might even be a case for it being its own crate perhaps?</p>



<a name="177501079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog/near/177501079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog.html#177501079">(Oct 07 2019 at 08:52)</a>:</h4>
<p>That way, it could be used for code-generation as a dev-dependency like for example lalrpop</p>



<a name="177521416"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog/near/177521416" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog.html#177521416">(Oct 07 2019 at 13:57)</a>:</h4>
<p>maybe.  Although it's not a complete solution that will take all datalog programs and spit out a perfect datafrog computation (datafrog has its own limitations and API requirements), I'm mostly interested in making it easy for us to test out things in polonius. I'll put it in its own "utils" crate for the time being, maybe with some of the other hacky things from my datafrog fork (eg "datalog provenance" AKA a println for every rule firing, and a function that extracts some target tuple's provenance from this log)</p>



<a name="177544276"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog/near/177544276" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog.html#177544276">(Oct 07 2019 at 18:03)</a>:</h4>
<p>datafrog generator moved here <a href="https://github.com/lqd/datapond" target="_blank" title="https://github.com/lqd/datapond">https://github.com/lqd/datapond</a> <span class="user-mention" data-user-id="116109">@Vytautas Astrauskas</span> (I plan to dogfood it there for a while, maybe add DT to it, etc, and then see what Niko and Frank think about upstreaming those to datafrog directly)</p>



<a name="177544492"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog/near/177544492" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog.html#177544492">(Oct 07 2019 at 18:05)</a>:</h4>
<p>(I hope it helps but it's likely not going to work 100%, it's really only intended in the limited context of polonius, not every datalog computation; and even then only gets you part of the way there, you still need to know datafrog and how to set it up etc)</p>



<a name="177574725"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog/near/177574725" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog.html#177574725">(Oct 08 2019 at 00:47)</a>:</h4>
<p>of course as soon as I add why-provenance, I actually also need why-not-provenance to understand what is going on in the flow sensitive equality variant <span aria-label="sweat" class="emoji emoji-1f613" role="img" title="sweat">:sweat:</span></p>



<a name="177593105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog/near/177593105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vytautas Astrauskas [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog.html#177593105">(Oct 08 2019 at 08:27)</a>:</h4>
<blockquote>
<p>datafrog generator moved here <a href="https://github.com/lqd/datapond" target="_blank" title="https://github.com/lqd/datapond">https://github.com/lqd/datapond</a> <span class="user-mention silent" data-user-id="116109">Vytautas Astrauskas</span> (I plan to dogfood it there for a while, maybe add DT to it, etc, and then see what Niko and Frank think about upstreaming those to datafrog directly)</p>
</blockquote>
<p>Thanks!</p>



<a name="185188304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog/near/185188304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vytautas Astrauskas [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog.html#185188304">(Jan 09 2020 at 07:06)</a>:</h4>
<p><span class="user-mention" data-user-id="116113">@lqd</span> Are you currently working on datapond?</p>



<a name="185188319"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog/near/185188319" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vytautas Astrauskas [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog.html#185188319">(Jan 09 2020 at 07:07)</a>:</h4>
<p>I would like to start using it for my project and, therefore, would like to finish converting it into a procedural macro.</p>



<a name="185189537"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog/near/185189537" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog.html#185189537">(Jan 09 2020 at 07:39)</a>:</h4>
<p><span class="user-mention" data-user-id="116109">@Vytautas Astrauskas</span>  I have been looking at different examples to find more bugs, and fixed a few, but there are more (related to renaming/arguments and index uses, etc) — but if "currently" means "right this second" then no :) I have seen you push cool new work! I also seem to have lost the query syntax we looked at during rustfest so haven't been able to do a lot wrt syntax/parsing unfortunately (but as mentioned I wanted to try more rule examples to find bugs first)</p>



<a name="185190496"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog/near/185190496" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog.html#185190496">(Jan 09 2020 at 08:01)</a>:</h4>
<p>(I think we’d want to test your queries before finishing the proc macro though ? Just to make sure it handles enough of what you need correctly-ish)</p>



<a name="185193794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog/near/185193794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vytautas Astrauskas [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog.html#185193794">(Jan 09 2020 at 08:55)</a>:</h4>
<p><span class="user-mention" data-user-id="116113">@lqd</span> Have you pushed all your changes? I am thinking to look into it in 4 hours or so.</p>



<a name="185193889"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog/near/185193889" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog.html#185193889">(Jan 09 2020 at 08:56)</a>:</h4>
<p>yeah, the rest of my (local) WIP isn't big and can be rebased easily</p>



<a name="185194791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog/near/185194791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vytautas Astrauskas [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog.html#185194791">(Jan 09 2020 at 09:12)</a>:</h4>
<p>Could you still please push it to some branch?</p>



<a name="185194843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog/near/185194843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vytautas Astrauskas [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog.html#185194843">(Jan 09 2020 at 09:13)</a>:</h4>
<p>I would like to restructure code a bit to make it easier to maintain, which would make your changes impossible to rebase.</p>



<a name="185198873"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog/near/185198873" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog.html#185198873">(Jan 09 2020 at 10:17)</a>:</h4>
<p><span class="user-mention" data-user-id="116109">@Vytautas Astrauskas</span>  I don't have access to this computer for a few days :/ go ahead don't worry about it, I'll take care of that afterwards, it was mostly about filtering index uses (so that random variable renaming would not generate duplicate useless indices)</p>



<a name="185198898"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog/near/185198898" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog.html#185198898">(Jan 09 2020 at 10:17)</a>:</h4>
<p>I also wanted to make structural changes so that it's also easier to test in isolation but haven't started yet</p>



<a name="185199198"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog/near/185199198" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vytautas Astrauskas [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog.html#185199198">(Jan 09 2020 at 10:22)</a>:</h4>
<p>OK. Thanks!</p>



<a name="185199218"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog/near/185199218" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vytautas Astrauskas [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog.html#185199218">(Jan 09 2020 at 10:23)</a>:</h4>
<p>Let's see how far I get <span aria-label="smile" class="emoji emoji-263a" role="img" title="smile">:smile:</span>.</p>



<a name="185200523"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog/near/185200523" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog.html#185200523">(Jan 09 2020 at 10:43)</a>:</h4>
<p>good luck :D</p>



<a name="185201066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog/near/185201066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/datalog-to-datafrog.html#185201066">(Jan 09 2020 at 10:52)</a>:</h4>
<p>(and also thanks &lt;3)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>